package paper.dao.impl;

import java.util.List;

import keter.dao.base.KeterAbstractDao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import paper.dao.ReportDao;
import paper.domain.AuditStatus;
import paper.domain.Report;
import paper.util.ConfigConstant;

@Repository
public class ReportDaoImpl extends KeterAbstractDao<Report> implements ReportDao {
	
    @Autowired
    private ConfigConstant conf;

	@Override
	public List<Report> findByCreator(Long id) {
		 return getResultList("from Report t where t.creator.id = :id", 
	              wrap("id"),
	              wrap(id));
		
	}

	/**
	 * <p>Method ：findSubmitAndPassedByMaster
	 * <p>Description : 查找状态为"提交"和"通过"的数据
	 * 
	 * @see paper.dao.ReportDao#findSubmitOrPassByMaster(java.lang.Long)
	 * @author  gulixing@msn.com
	 * @version 1.0.0
	 */
	@Override
	public List<Report> findSubmitOrPassByMaster(Long id) {
		return getResultList("from Report t where t.master.id = :id and t.status='submit' or t.status='pass'", 
				 wrap("id"),
	             wrap(id));
	}  
}